package nl.liacs.swi.tower;

/*
 * Map class.
 * 
 * The map class contains a matrix map[] which represents
 * the world in terms of titles (0 = grass, 1 = road). 
 * In order to change the world/road, simply change the 
 * matrix values.
 * 
 */

public class Map {

	private static Map ref;
	
	final static int WIDTH = 13;
	final static int HEIGHT = 11;

	public int map[][] = new int[][] {
			{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
			{ 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
			{ 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 2 },
			{ 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0 },
			{ 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0 },
			{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0 },
			{ 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0 },
			{ 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0 },
			{ 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0 },
			{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
			{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };

	public static double pheromones[][] = new double[HEIGHT][WIDTH];
	private static double pheromone_base_value = 1;

	private Map() {
	}

	public int[][] getMapCopy() {
		int[][] copy = new int[HEIGHT][WIDTH];
		for (int x = 0; x < WIDTH; x++) {
			for (int y = 0; y < HEIGHT; y++) {
				copy[y][x] = map[y][x];
			}
		}
		return copy;
	}

	/**
	 * @return number of fields in width
	 */
	public static int getWidth() {
		return WIDTH;
	}

	/**
	 * @return number of fields in height
	 */
	public static int getHeight() {
		return HEIGHT;
	}

	public static Map getSingletonObject() {
		if (ref == null)
			// it's ok, we can call this constructor
			ref = new Map();
		return ref;
	}

	public Object clone() throws CloneNotSupportedException {
		throw new CloneNotSupportedException();
		// that'll teach 'em
	}
	
	public static double getPheromone_base_value() {
		return pheromone_base_value;
	}

	public void setPheromone_base_value(int pheromone_base_value) {
		this.pheromone_base_value = pheromone_base_value;
	}
}